Re: Questions about Exists-Not exists clause

Поиск
Список
Период
Сортировка
От M Spreij
Тема Re: Questions about Exists-Not exists clause
Дата
Msg-id a05210603bb45f5857086@[192.168.1.12]
обсуждение исходный текст
Ответ на Re: Questions about Exists-Not exists clause  (Nabil Sayegh <postgresql@e-trolley.de>)
Ответы Re: Questions about Exists-Not exists clause  (Avi Schwartz <avi@CFFtechnologies.com>)
Re: Questions about Exists-Not exists clause  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-novice
>  > I've got, imagine, the next two tables:
>  >
>  > table A:
>  >
>  > field1    char(3)
>  > field2    varchar(50)
>  > field3    numeric(6)
>  >
>  >
>  > table B:
>  >
>  > field4    date
>  > field5    time
>  > field6    numeric(6)
>  >
>  >
>  > I need to know which rows in table A are not in table B, and the join
>  > fields are the two numeric ones (field3 and field6).
>
>SELECT * FROM A WHERE NOT EXISTS (SELECT NULL FROM B WHERE
>A.field3=B.field6);

I did this recently, using
SELECT * FROM A WHERE field3 NOT IN (SELECT field6 FROM B)

Now if this is totally wrong tell me *gently*, it's the first
question I felt I was up to to answer :-)

Regards,

     Martin
--
<mailto:mac.com@nemo>
<http://www.mechintosh.com/>

В списке pgsql-novice по дате отправления:

Предыдущее
От: Dag Gullberg
Дата:
Сообщение: Re: question about images
Следующее
От: M Spreij
Дата:
Сообщение: Re: design/copying a bunch of records